package com.example.petproject.controller;

import com.example.petproject.entity.vo.ByCategoryIdsVO;
import com.example.petproject.entity.vo.ReturnVO;
import com.example.petproject.service.PmsProductAttributeService;
import com.example.petproject.service.impl.PmsProductAttributeServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 包名称：com.example.petproject.controller
 * 类名称：AttributeController
 * 类描述：根据分类ID查询商品属性列表接口
 * 创建人：@author DrinkMore-HotWater
 * 创建时间：2024年01月05日 14:53
 **/
@RestController
@RequestMapping("pms/product/attribute")
@Tag(name = "商品属性接口")
public class PmsProductAttributeController {

    @Resource
    private PmsProductAttributeService pmsProductAttributeService;

    @PostMapping("/byCategoryIds")
    @Operation(summary = "根据分类ID查询商品属性列表接口")
    public ReturnVO<List<ByCategoryIdsVO>> getByCategoryIds(@RequestBody List<Integer> ids){
        return ReturnVO.ok(pmsProductAttributeService.getByCategoryIds(ids));
    }

    @GetMapping("/list")
    @Operation(summary = "查询所有商品属性列表接口")
    public ReturnVO<List<ByCategoryIdsVO>> list(){
        return ReturnVO.ok(pmsProductAttributeService.getAllList());
    }


}
